import React, { useMemo } from 'react';
import { Input } from 'antd';
import { INodeComponent } from './type';

export const NodeInput: React.FC<INodeComponent> = (props) => {
  const data = useMemo(() => {
    return props?.data;
  }, [props?.data]);

  const onInputChange = (e: any) => {
    if (e && props?.onChange) {
      props.onChange(e?.target?.value);
    }
  };
  return (
    <Input
      placeholder={`请填写${data.labelName}`}
      onChange={onInputChange}
      title={`请填写${data.labelName}`}
      value={props.value ?? ''}
    />
  );
};
